﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="RelacionesAddAmenContr.aspx.cs" Inherits="AudiPyme.UI.RelacionesAddAmenContr" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        function expandDetailsInGrid(_this) {
            var id = _this.id;
            var imgelem = document.getElementById(_this.id);
            var currowid = id.replace("A_View", "TR_Summmary") //Coge el Id la fila seleccionada

            var rowdetelemid = currowid;
            var rowdetelem = document.getElementById(rowdetelemid);
            if (imgelem.alt == "plus") {
                imgelem.src = "minus.gif"
                imgelem.alt = "minus"
                rowdetelem.style.display = 'block';
            }
            else {
                imgelem.src = "plus.gif"
                imgelem.alt = "plus"
                rowdetelem.style.display = 'none';
            }

            return false;

        }
    </script>
    <h2>
        Relaciones Amenazas-Control<asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
    </h2>
    <p>
    </p>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <h4>
                Número de Relaciones Seleccionadas:<asp:Label ID="LblControl" runat="server" CssClass="alignright"
                    Text="0" Width="30px"></asp:Label>
            </h4>
            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
                AutoGenerateColumns="False" OnPageIndexChanging="GridView1_PageIndexChanging">
                <Columns>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:ImageButton ID="A_View" runat="server" AlternateText="plus" ImageUrl="~/plus.gif"
                                OnClientClick="expandDetailsInGrid(this);return false;" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="IdControl" HeaderText="IdControl" />
                    <asp:BoundField DataField="Nombre" HeaderText="Nombre" />
                    <asp:BoundField DataField="IdAmenaza" HeaderText="IdAmenaza" />
                    <asp:BoundField DataField="Amenaza" HeaderText="Amenaza" />
                    <asp:TemplateField HeaderText="Opciones">
                        <ItemTemplate>
                            <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" OnCheckedChanged="CheckBox_Changued" />
                            </td> </tr>
                            <tr id="TR_Summmary" runat="server" style="display: none">
                                <td colspan="6">
                                    <table>
                                        <tr>
                                            <td>
                                            </td>
                                            <td>
                                                <asp:Label ID="Label1" runat="server" Text='<%#Eval("Descripcion")%>'></asp:Label>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <PagerSettings Mode="NumericFirstLast" />
            </asp:GridView>
            <p>
                <asp:Button ID="BtnInsertar" runat="server" OnClick="BntControl_Click" 
                    Text="Insertar" Enabled="False" />
                <asp:Label ID="LblInsertar" runat="server"></asp:Label>
            </p>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
